"use server";
import { Flex, Menu, message } from "antd";
import "./index.css";
import { getQuestionBankVoByIdUsingGet } from "@/api/questionBankController";
import React from "react";
import Title from "antd/es/typography/Title";
import { getQuestionVoByIdUsingGet } from "@/api/questionController";
import Sider from "antd/es/layout/Sider";
import { Content } from "antd/es/layout/layout";
import QuestionCard from "@/components/QuestionCard";
import Link from "next/link";


/**
 * 题目详情页
 * @constructor
 */
export default async function QuestionPage({ params }) {
  let { questionId } = params;

  //  获取题目详情
  let question = undefined;
  try {
    const result = await getQuestionVoByIdUsingGet({
      id: questionId,
    });
    question = result.data;
  } catch (e) {
    message.error("获取题库列表失败，" + e.message);
  }
  //  错误处理
  if (!question) {
    return <div>获取题目详情失败，请刷新重试</div>;
  }

  return (
    <div id="questionPage">
      <Flex gap={24}>
        <Content>
          <QuestionCard question={question}></QuestionCard>
        </Content>
      </Flex>
    </div>
  );
  }
